package cz.acies.face.viewers;

import java.lang.reflect.Type;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;

public class TableColumnDefineSerializer implements JsonSerializer<TableColumnDefine>
{
	@Override
	public JsonElement serialize(TableColumnDefine define, Type type, JsonSerializationContext context) {
		final JsonObject json = new JsonObject();

		json.addProperty("field", define.getId());
		json.addProperty("title", define.getCaption());
		json.addProperty("width", define.getWidth()); 
		//json.addProperty("dataType", define.getType());
		json.addProperty("align", define.getAlignment());
		json.addProperty("hidden", false);
		json.addProperty("editable", false);
		json.addProperty("sortable", define.isSortable());
		
		//title
		//field			
		//width
		//rowspan		number
		//colspan		number
		//align			string
		//halign		string
		//sortable		boolean
		//order			string
		//resizable		boolean
		//fixed			boolean
		//hidden		boolean
		//checkbox		boolean
		//formatter

	    return json;
	}

}
